import MUntilS   from 'util/mm.jsx'
const _mm = new MUntilS();

class User{
    login(dataInfo){
        return _mm.request({
            type:'post',
            url:'/manage/user/login.do',
            data:dataInfo
        })
    }
    //检查登录接口数据
    checkLoginInfo(dataInfo){
        let username = $.trim(dataInfo.username),
            password = $.trim(dataInfo.password);
        //判断用户名为空
        if(typeof username != 'string' || username.length==0){
            return {
                status:false,
                msg:'用户名不能为空'
            }
        }
        // 密码
        if(typeof password != 'string' || password.length==0){
            return {
                status:false,
                msg:'密码不能为空'
            }
        }
        return {
            status:true,
            msg:'验证通过'
        }
    }
    //退出登录
    logout(){
        return _mm.request({
            type:'post',
            url:'/user/logout.do',
        })
    }
    //获取用户列表
    getUserList(num){
        return _mm.request({
            type:'post',
            url:'/manage/user/list.do',
            data:{
                pageNum : num
            }
        })
    }
}
export default User;